﻿using System.Security;
using System;

namespace Microsoft.Coding4Fun.TweetCraft.Twitter
{
    /// <summary>
    /// Retrieves tweets and adds new status updates to the user's Twitter feed.
    /// </summary>
    public interface ITwitterClient
    {
        /// <summary>
        /// Gets or sets the Twitter username.
        /// </summary>
        string UserName { get; set; }

        /// <summary>
        /// Gets or sets the Twitter OAuth Token.
        /// </summary>
        string Token { get; set; }

        /// <summary>
        /// Gets or sets the Twitter OAuth Token Secret.
        /// </summary>
        SecureString TokenSecret { get; set; }

        /// <summary>
        /// Gets the status of the Twitter client.
        /// </summary>
        TwitterClientStatus Status { get; }

        /// <summary>
        /// Raised when the <see cref="Status"/> changes.
        /// </summary>
        event EventHandler StatusChanged;

        /// <summary>
        /// Gets the OAuth request token.
        /// </summary>
        /// <returns></returns>
        string[] GetRequestToken();

        /// <summary>
        /// Gets the OAuth access token, after a request has been through the authorization step.
        /// </summary>
        /// <param name="requestToken">The OAuth request token.</param>
        /// <param name="verifier">The user verification code.</param>
        /// <returns></returns>
        string[] GetAccessToken(string[] requestToken, string verifier);

        /// <summary>
        /// Gets the tweets in the Public timeline.
        /// </summary>
        /// <returns>An array of <see cref="Tweet"/> instances.</returns>
        Tweet[] GetPublicTimeline();

        /// <summary>
        /// Gets the tweets in the Friends timeline.
        /// </summary>
        /// <returns>An array of <see cref="Tweet"/> instances.</returns>
        Tweet[] GetFriendsTimeline();

        /// <summary>
        /// Gets the replies.
        /// </summary>
        /// <returns>An array of <see cref="Tweet"/> instances.</returns>
        Tweet[] GetMentions();

        /// <summary>
        /// Adds a <see cref="Tweet"/> to the user's Twitter feed.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns>An instance of the <see cref="Tweet"/> class.</returns>
        Tweet AddTweet(string message);

        /// <summary>
        /// Uploads and posts a picture to Twitter without any extra message.
        /// </summary>
        /// <param name="picturePath">The path to the picture.</param>
        Tweet UploadAndPost(string picturePath);

        /// <summary>
        /// Uploads and posts a message and a picture to Twitter.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="picturePath">The path to the picture.</param>
        Tweet UploadAndPost(string picturePath, string message);
    }
}
